<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateSystemTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('system', function (Blueprint $table) {
            $table->increments('id');
            $table->tinyInteger('pid')->default(0)->comment('所属类别ID');
            $table->string('title', 50)->comment('字段名称');
            $table->string('key', 20)->comment('字段代码');
            $table->char('type', 10)->default('string')->comment('字段类型');
            $table->text('value')->comment('字段值');
            $table->string('value_range')->default('')->comment('值范围');
            $table->string('tip')->default('')->comment('字段提示');
            $table->integer('sort')->default(0)->comment('字段排序');
            $table->index('sort');
            $table->index('pid');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('system');
    }
}
